#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int p,m,n,score;
string id;
struct Stu{
    string id;
    int gp = -1,gm = -1,gf = -1;
    int sum = -1;
};
map<string,Stu> ma;
vector<Stu> v;

int cmp(Stu &s1,Stu &s2){
    if(s1.sum==s2.sum)    return s1.id<s2.id;
    return s1.sum>s2.sum;
}

signed main()
{
    cin>>p>>m>>n;
    for(int i=0;i<p;i++){
        cin>>id>>score;
        ma[id].id = id;
        ma[id].gp = score;
    }
    for(int i=0;i<m;i++){
        cin>>id>>score;
        ma[id].id = id;
        ma[id].gm = score;
    }
    for(int i=0;i<n;i++){
        cin>>id>>score;
        ma[id].id = id;
        ma[id].gf = score;
    }
    for(auto it:ma){
        if(it.second.gp>=200){
            int mi = it.second.gm,fi = it.second.gf;
            if(mi>fi)    it.second.sum = (int)round(mi*0.4+fi*0.6);
            else    it.second.sum = fi;
            if(it.second.sum>=60)    v.push_back(it.second);
        }
    }
    sort(v.begin(),v.end(),cmp);
    for(int i=0;i<v.size();i++){
        cout<<v[i].id<<" "<<v[i].gp<<" "<<v[i].gm<<" "<<v[i].gf<<" "<<v[i].sum<<"\n";
    }
    return 0;
}
